package gitee.derumin.lifeissohard.generate.recipes;

import gitee.derumin.lifeissohard.item.LishItems;
import net.minecraft.advancement.criterion.InventoryChangedCriterion;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.item.Items;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.registry.tag.ItemTags;

import java.util.function.Consumer;

public class Crafting {
    public static void generateShapelessRecipes(Consumer<RecipeJsonProvider> exporter) {
        ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC,LishItems.PROCESSING_UNIT)
                .input(Items.COMPARATOR)
                .input(Items.REPEATER)
                .input(Items.OBSERVER)
                .input(Items.REDSTONE,2)
                .input(Items.QUARTZ,2)
                .criterion("get_blood_tester", InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER))
                .criterion("get_blood_tester_used",InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER_USED))
                .criterion("get_processing_unit",InventoryChangedCriterion.Conditions.items(LishItems.PROCESSING_UNIT))
                .offerTo(exporter);
    }
    public static void generateShapedRecipes(Consumer<RecipeJsonProvider> exporter){
        ShapedRecipeJsonBuilder.create(RecipeCategory.MISC,LishItems.SMALL_SCREEN,4)
                .input('a',Items.GLASS_PANE)
                .input('b',Items.QUARTZ)
                .input('c',Items.REDSTONE)
                .input('d',Items.GREEN_DYE)
                .pattern(" a ")
                .pattern("bdb")
                .pattern("cac")
                .criterion("get_blood_tester", InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER))
                .criterion("get_blood_tester_used",InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER_USED))
                .criterion("get_small_screen",InventoryChangedCriterion.Conditions.items(LishItems.SMALL_SCREEN))
                .offerTo(exporter);
        ShapedRecipeJsonBuilder.create(RecipeCategory.MISC,LishItems.LARGE_SCREEN)
                .input('a',Items.GLASS_PANE)
                .input('b',Items.QUARTZ)
                .input('c',Items.REDSTONE)
                .input('d',Items.GREEN_DYE)
                .pattern("cac")
                .pattern("bdb")
                .pattern("cac")
                .criterion("get_small_screen",InventoryChangedCriterion.Conditions.items(LishItems.SMALL_SCREEN))
                .criterion("get_large_screen",InventoryChangedCriterion.Conditions.items(LishItems.LARGE_SCREEN))
                .offerTo(exporter);
        ShapedRecipeJsonBuilder.create(RecipeCategory.MISC,LishItems.BLOOD_TESTER)
                .input('a',LishItems.SMALL_SCREEN)
                .input('b',LishItems.PROCESSING_UNIT)
                .input('c', ItemTags.PLANKS)
                .input('d',Items.BLUE_DYE)
                .input('e',Items.IRON_INGOT)
                .pattern("dad")
                .pattern("cbc")
                .pattern(" e ")
                .criterion("get_blood_tester", InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER))
                .criterion("get_blood_tester_used",InventoryChangedCriterion.Conditions.items(LishItems.BLOOD_TESTER_USED))
                .offerTo(exporter);
    }
}
